﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Routing;

namespace FitnessMVCWeb.Helpers
{
    public class Int32Constraint : IRouteConstraint
    {
        public Int32Constraint()
        {

        }

        #region IRouteConstraint Members

        public bool Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection)
        {
            string passedInVal = values[parameterName].ToString();
            Int32 i;
            if (!Int32.TryParse(passedInVal, out i))
                return false;

            return true;
        }

        #endregion
    }
}
